renderbackground: Only query h/vrepeat if we need to
authorTimm Bäder <mail@baedert.org>
Sun, 21 Jun 2020 06:31:24 +0000 (08:31 +0200)
committerTimm Bäder <mail@baedert.org>
Sat, 27 Jun 2020 08:51:06 +0000 (10:51 +0200)
gtk/gtkrenderbackground.c

index fb17730900dbc24eae5b4de2d74daa3d2eb9257d..11c9c109c668b03d29f34c9c0c9b3854fc965c12 100644 (file)
@@ -94,9 +94,6 @@ gtk_theming_background_snapshot_layer (GtkCssBoxes *bg,
 
   pos = _gtk_css_array_value_get_nth (background->background_position, idx);
   repeat = _gtk_css_array_value_get_nth (background->background_repeat, idx);
-  hrepeat = _gtk_css_background_repeat_value_get_x (repeat);
-  vrepeat = _gtk_css_background_repeat_value_get_y (repeat);
-
 
   origin = gtk_css_boxes_get_box (bg,
                                   _gtk_css_area_value_get (
@@ -125,8 +122,13 @@ gtk_theming_background_snapshot_layer (GtkCssBoxes *bg,
   /* optimization */
   if (image_width == width)
     hrepeat = GTK_CSS_REPEAT_STYLE_NO_REPEAT;
+  else
+    hrepeat = _gtk_css_background_repeat_value_get_x (repeat);
+
   if (image_height == height)
     vrepeat = GTK_CSS_REPEAT_STYLE_NO_REPEAT;
+  else
+    vrepeat = _gtk_css_background_repeat_value_get_y (repeat);
 
   gtk_snapshot_push_debug (snapshot, "Layer %u", idx);
   gtk_snapshot_push_rounded_clip (snapshot, clip);